package com.zhonghui.license;

import de.schlichtherle.license.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.text.SimpleDateFormat;
import java.util.prefs.Preferences;

public class LicenseVerify {
    private static Logger logger = LogManager.getLogger(LicenseVerify.class);

    public LicenseVerify() {
    }

    public synchronized LicenseContent install(LicenseVerifyParam param) {
        LicenseContent result = new LicenseContent();
        return result;
    }

    public boolean verify() {
        return true;
/*
        try {
            LicenseContent licenseContent = licenseManager.verify();
            return true;
        } catch (Exception var4) {
            logger.error("证书校验失败！", var4);
            return false;
        }
*/
    }

    private LicenseParam initLicenseParam(LicenseVerifyParam param) {
        Preferences preferences = Preferences.userNodeForPackage(LicenseVerify.class);
        CipherParam cipherParam = new DefaultCipherParam(param.getStorePass());
        KeyStoreParam publicStoreParam = new CustomKeyStoreParam(LicenseVerify.class, param.getPublicKeysStorePath(), param.getPublicAlias(), param.getStorePass(), (String)null);
        return new DefaultLicenseParam(param.getSubject(), preferences, publicStoreParam, cipherParam);
    }
}
